package complexity;

public class ComplexExample {

	/**
	 * Complexity = 2, Depth = 2
	 */
	public boolean isLeapYearV1(int year) {
		return (year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0));
	}

	/**
	 * Complexity = 1, Depth = 2
	 */
	public boolean isLeapYearV2(int year) {
		boolean result = (year % 400 == 0) || (year % 4 == 0) && (year % 100 != 0);
		return result;
	}

	/**
	 * Complexity = 4, Depth = 3
	 */
	public boolean isApple(String name) {
		if (name == null) {
			throw new IllegalArgumentException();
		} else {
			return name.equals("Apple") || name.equals("apple");
		}
	}

	/**
	 * Complexity = 1, Depth = 2
	 */
	public boolean callMethodIsApple(String name) {
		return isApple(name);
	}
}
